package caiziyou.com.designpattern.commond;

public class Client {

	public static void main(String[] args) {
		LightReceiver lightReceiver = new LightReceiver();
		
		LightOnCommond lightOnCommond = new LightOnCommond(lightReceiver);
		LightOffCommond lightOffCommond = new LightOffCommond(lightReceiver);
		
		RemoateController remoateController = new RemoateController();
		
		remoateController.setCommond(0, lightOnCommond, lightOffCommond);
		
		System.out.println("按下灯开的按钮");
		remoateController.onButtonPushed(0);
		
		System.out.println("按下灯关的按钮");
		remoateController.offButtonPushed(0);
		System.out.println("撤销");
		remoateController.undoButtonPush();
		
		TvReceiver tvReceiver = new TvReceiver();
		TvOnCommond tvOnCommond = new TvOnCommond(tvReceiver);		
		TvOffCommond tvOffCommond = new TvOffCommond(tvReceiver);
		
		remoateController.setCommond(1, tvOnCommond, tvOffCommond);
		
		System.out.println("按下电视机开的按钮");
		remoateController.onButtonPushed(1);
		
		System.out.println("按下电视机关的按钮");
		remoateController.offButtonPushed(1);
		System.out.println("撤销");
		remoateController.undoButtonPush();
	}
}
